<?php

namespace App\Models\User;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class WxUserOnline extends Model
{
	use HasDateTimeFormatter;

	protected $fillable = ['user_id', 'online', 'device'];
    protected $table = 'wx_user_online';

    protected $primaryKey = 'user_id';

    public $timestamps = false;

    public function getDeviceAttribute($v)
    {
        if($v){
            return ['app'=>'App', 'h5'=>'H5', 'mp'=>'小程序', 'pc'=>'PC端'][$v];
        }else{
            return '';
        }
    }
}
